package demo

/**
  * 元祖Tuple
  */
object TupleDemo {

  //声明元祖
  var t1 = (1, "213", 2.2)

  //取值 ._元素位置
  t1._2

  val t2 = (1, 2, (3, 4))
  //取出 4
  t2._3._2

  val t3 = (1, 2, (Array(3, 4), List((5, 6), (7, 8))))

  val value: Int = t3._3._2(0)._2

  var m1 = Map("tom" -> 12, "jerry" -> 13, "rose" -> 32)
  //用元组来操作Map
  var m2 = m1.map(x => (x._1, x._2 + 1))


  def main(args: Array[String]): Unit = {
    println(value)
  }

}
